package com.ppc.mapper.worker;

import com.github.pagehelper.Page;
import com.ppc.entity.Claim;
import com.ppc.vo.ClaimDetailVO;
import com.ppc.vo.ClaimMessageVO;
import com.ppc.vo.ClaimPageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 申诉相关mapper
 *
 * @author Jeferry
 * @date 2023/12/20
 */
@Mapper
public interface WorkerClaimMapper {

  /**
   * 插入申诉
   *
   * @param claim 申诉类
   */
  void insert(Claim claim);

  /**
   * 分页查询
   *
   * @param claimStatus 状态
   * @return {@link Page}<{@link ClaimPageVO}>
   */
  Page<ClaimPageVO> pageQuery(Integer claimStatus, Long userId);

  /**
   * 查询申诉细节
   *
   * @param claimId 申诉id
   * @return {@link ClaimDetailVO}
   */
  ClaimDetailVO queryClaimDetail(Long claimId);

  /**
   * 获取申诉信息
   *
   * @param currentUserId   当前用户id
   * @param currentWorkerId 当前工人id
   * @return {@link Page}<{@link ClaimMessageVO}>
   */
  Page<ClaimMessageVO> getClaimMessage(Long currentUserId, Long currentWorkerId);

  /**
   * 查询任务所属的雇主id
   *
   * @param taskId 任务id
   * @return {@link Long}
   */
  @Select("select employer_id from requirement,task where requirement.require_id=task.require_id and task_id=#{taskId}")
  Long queryNotifyId(Long taskId);
  @Update("update task set task_status=#{taskStatus} where task_id=#{taskId}")
  void changeTaskStatusIntoClaim(Long taskId,Integer taskStatus);
}
